package com.example.practice.service.impl;

import com.example.practice.api.DemoService;
import com.example.practice.pojo.DemoDTO;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description:
 * @author: helong.sun
 * @date: 2020-12-23 16:59
 * @Version 1.0
 **/
@Service
public class DemoServiceImpl implements DemoService {

    @Override
    public String getName(DemoDTO demoDTO) {
        // 模拟DB
        List<String> nameList = Arrays.asList("孙文博","孙贺龙","赵家康");
        return nameList.stream()
                .filter(data-> data.contains(demoDTO.getName()))
                .collect(Collectors.joining(","));
    }
}
